package saint.UI;

import android.content.Context;
import android.graphics.*;
import android.view.View;

/**
 * Create background 
 * @author Saint
 *
 */
class RoundRectange extends View {
	private RectF mBounds;
	private Paint recPaint;
	private float mRoundConner;

	public RoundRectange(Context context) {
		super(context);
		mBounds = new RectF();
		recPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
		recPaint.setColor(Color.GRAY);
		recPaint.setAlpha(50);
		mRoundConner = 10;
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		canvas.drawRoundRect(mBounds, mRoundConner, mRoundConner, recPaint);
	}

	@Override
	protected void onSizeChanged(int w, int h, int oldh, int oldw) {
		mBounds.set(0, 0, w, h);
	}
	
	public void setColor(int color) {
		recPaint.setColor(color);
		invalidate();
	}
	
	public void setRoundConner(float value) {
		mRoundConner = value;
		invalidate();
	}
	
	public void setAlpha(int value) {
		recPaint.setAlpha(value);
		invalidate();
	}
	
}
